package com.boarsoft.web.websocket;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @author Mac_J
 *
 */
public class WebsocketMessage {
	public static final short TYPE_TEXT = 0;
	public static final short TYPE_BINARY = 1;
	public static final short TYPE_OBJECT = 2;
	
	/** 消息发送者的TOKEN */
	protected String token;
	/** 消息类型 */
	protected short type = TYPE_TEXT;
	/** 消息分组类型 */
	protected String group;
	/** 消息编码 */
	protected String code;
	/** 收件人userId */
	protected List<String> recipients = new ArrayList<String>();
	/** 消息数据，通常为字符串 */
	protected Object data;

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public short getType() {
		return type;
	}

	public void setType(short type) {
		this.type = type;
	}

	public String getGroup() {
		return group;
	}

	public void setGroup(String group) {
		this.group = group;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public List<String> getRecipients() {
		return recipients;
	}

	public void setRecipients(List<String> recipients) {
		this.recipients = recipients;
	}

	public void addReceipient(String code) {
		this.recipients.add(code);
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
}
